<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/1/17
 * Time: 15:16
 */
namespace app\team\controller;

use think\Db;
use think\Request;
use app\tour\model\Album as AlbumModel;
use app\tour\model\Tour as TourModel;
use think\Session;
class Notice extends Common
{
    public function notice()
    {
        $res = Db::name('team_default')->where('team_id',Session::get('team')['team_id'])->find();
        $this->assign('res',$res);
        return view();
    }

    public function editTeamInfo()
    {
        if (Request::instance()->isAjax()){

            $post = Request::instance()->post();
            $post = $post['data'];
            $post['team_id'] = Session::get('team')['team_id'];
            $cun = Db::name('team_default')->where('team_id',Session::get('team')['team_id'])->find();
            if($cun){
                 $res = Db::name('team_default')->where('team_id',Session::get('team')['team_id'])->update($post);
             }else{
                 $res = Db::name('team_default')->insert($post);
             }
           
            if ($res !== false){

                return ['code'=>0];

            }else{

                return ['code'=>1];

            }

        }
    }
}